package cn.com.code.hwjs;

import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Scanner;

/**
 * HJ23 删除字符串中出现次数最少的字符
 * https://www.nowcoder.com/practice/05182d328eb848dda7fdd5e029a56da9?tpId=37&tqId=21246&rp=1&ru=/exam/oj/ta&qru=/exam/oj/ta&sourceUrl=%2Fexam%2Foj%2Fta%3FtpId%3D37&difficulty=undefined&judgeStatus=undefined&tags=&title=
 *
 * @author zhengpei
 * @date 2022/5/15
 */
public class Hwjs23 {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    while (sc.hasNext()) {
      String s = sc.nextLine();
      replaceStr(s);
    }
  }

  private static void replaceStr(String s) {
    char[] chars = s.toCharArray();
    Map<Character, Integer> map = new LinkedHashMap<>();
    for (Character c : chars) {
      map.put(c, map.getOrDefault(c, 0) + 1);
    }

    int min = Integer.MAX_VALUE;
    for (int m : map.values()) {
      min = Math.min(m, min);
    }

    StringBuilder stringBuilder = new StringBuilder();
    for (char c : chars) {
      if (map.get(c) != min) {
        stringBuilder.append(c);
      }
    }

    System.out.println(stringBuilder.toString());
  }

}
